home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mgr / sparcmgr / demo2.zoo / demo / ex / TODO / text0000.txt < prev    next >
Encoding:
Text File  |  1984-06-11  |  30.7 KB  |  637 lines

  1. The following are (i) a short note from Mark Horton
  2. in reply to a note of mine saying I'd been keeping notes
  3. on editor bugs, had heard he had a new version, was
  4. interested in hearing about it and perhaps sending
  5. him notes on bugs not mentioned as corrected; (ii)
  6. a long letter from me in which I do list bugs, features
  7. I think would be desirable etc., (iii) an addendum I
  8. sent the next day, (iv) brief jottings not yet sent.
  9.  
  10. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  11. >From mark@cbosgd.UUCP Thu Jul 21 12:31:55 1983
  12.  
  13. The new version of vi isn't very different to the user.
  14. The internals use terminfo instead of termcap, but the
  15. user interface isn't affected by this (except that it
  16. starts up faster).  The major new features are
  17.     set showmode
  18.         will cause an indication on the status line when
  19.         you are in input mode
  20.     vedit
  21.         is a new invocation of vi for novices
  22.     more function keys now work
  23.     function keys work in both command and input mode
  24. Of course, there are a few bug fixes too.
  25.  
  26. There is a binary in ~mark/bin/vi on ucbarpa.  It requires the
  27. /etc/term heirarchy (there is no file called /etc/terminfo) which
  28. was on ucbarpa once but might be gone now.  If you want to grab
  29. them from whereever they still exist, please feel free to try them.
  30.     Mark
  31. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  32. Sent to Mark Horton  23/7/83, about 11AM
  33.  
  34. Dear Mark,
  35.  
  36.      Well, your note didn't say you wanted me to send my comments
  37. on editor bugs and suggestions, but you didn't say I shouldn't,
  38. so I decided to do so.  I've tried to organize it into some sort
  39. of sections.  I'd be interested to know which of the bugs mentioned
  40. here you have already found and corrected.  (I may soon find out for
  41. myself; the person in charge of this machine says he'll try to get a
  42. copy of version 3.9 from UCBARPA if they still have it, and get it
  43. running for me.  If you have any helpful information for him, he
  44. is robert@brahms, Robert Gross.)
  45.      Vedit sounds like a great idea.
  46.      I should mention that throughout this letter, I have
  47. avoided using actual control-characters, but faked them,
  48. e.g. used ^ and H to get the appearance of ^H, since files with
  49. real control-characters can be confusing when looked at in mail,
  50. more, etc.  But this means that if you want to try any commands I
  51. refer to that use them, you won't be able to yank and source them,
  52. unless you replace my fakes with real control characters.
  53.      The version I am using is 3.7.
  54.  
  55.  
  56. PROBLEMS WITH COUNTS
  57.  
  58.      Some  vi operations that logically ought to be able to take
  59. counts do not, while others misbehave with counts.  In this section,
  60. ``N'' will always denote a positive integer placed as a count before
  61. a vi operation.
  62.      The most gross case of misbehavior is that of N^B!
  63. The effect is to redraw the screen 23N-44 lines further advanced.
  64. (Probably the numbers depend on the screen-size of the terminal;
  65. this is on a Z19, using termcap h19u.)  When N=1, this does indeed
  66. move you a screenful backward, but for higher N it moves the window
  67. forward some amount!  Further, whatever controls are supposed to
  68. monitor whether the command would land one at an acceptable line-
  69. number seem to have a different idea of what it is doing:  If you
  70. aren't already familiar with these weird effects, try setting the
  71. cursor near the end of a file that is more than 4 screenfuls long,
  72. and hitting 3^B.  (You might then try an insert at the place you get
  73. to, and a :f^] .)
  74.      N/pattern/ would be useful, but is not allowed.
  75.      ND would be a natural synonym for dN$, by analogy with NC for cN$,
  76. but it doesn't work that way; it just ignores the N.
  77.      Finally, if N is precisely the number of lines
  78. from the current line to the end of the file,  N$  will still correctly
  79. carry one to the last character of the file, but cN$, NC, dN$ and yN$
  80. refuse to do anything!  (NY does work, not being a synonym for yN$.)
  81. The failure of NC is particularly annoying; often when I am composing
  82. something, I go back to somewhere in the middle of the next-to-
  83. last line, say, and want to rewrite the rest of the sentence;
  84. 2cc would kill not only the part I want to rewrite but also the OK
  85. beginning of the line, and 2C or 2c$ won't work.  I realize that I
  86. could get around this by keeping an empty line at the end of the file,
  87. but that should not be necessary.
  88.  
  89.  
  90. PROBLEMS REGARDING SOURCE, MACROS, MAPPINGS
  91.      These are enormously useful, but seem to have all kinds of hidden
  92. restrictions.
  93.  
  94.      The Appendix to the Ex Reference Manual, "List of Changes from
  95. Version 3.5 to Version 3.6" says ``A bug which prevented the source
  96. command from working...from visual has been fixed''.  It is true that
  97. one can now use  :so  from vi, but it still has a bug:  When
  98. the scriptfile invoked contains a global command
  99. and some other command(s) after it, everything after the first global
  100. command is ignored.  The same appears to be true of scripts in named
  101. buffers invoked from vi-bottom-line by  @x.
  102.  
  103.      (It is, perhaps, unexpected that one can invoke scripts with
  104. multiline commands using @x from vi's bottom-line at all, since such
  105. commands will not work if typed on vi's bottom line directly.
  106. A script like
  107.     s/$/a\
  108.     b
  109. invoked as @x will indeed work.  But strangely, if one tries to
  110. invoke from the regular mode of vi the script
  111.     :s/$/a\
  112.     b
  113. by putting it in buffer x and doing  @x, only the first line
  114. will take effect.)
  115.  
  116.      Another serious restriction is that the command ``vi'' appears to
  117. be ignored in sourced ex-scripts, and though the command Q in macros of
  118. various flavors in vi (mapped characters, map!ed characters that contain
  119. ``...^V^[...Q...'';  @x scripts) does take one into ex, any ex
  120. commands after it are ignored.
  121.  
  122.      I assume you are aware of whatever restrictions lead to the
  123. error-message ``Cannot yank inside global/macro'', since you must
  124. have written it, though ``inside'' seems to here have the peculiar
  125. meaning ``after a text-changing operation of the macro.''
  126.      The error-message ``Can't undo in global commands'' is more
  127. mysterious, since I get it when I have a global command after
  128. a text-changing command in an @x script (though not in a sourced file).
  129.      Anyway, the fewer such restrictions these operations were subject
  130. to, the more useful they would be!
  131.  
  132.      Although nested source commands are allowed (and I find them
  133. useful), they leave the editor in a ``noprompt'' state.  This
  134. can be gotten around by including ``se prompt'' as a line in the
  135. outermost scriptfile, but I would hope the problem causing it could
  136. be cured.
  137.  
  138.      When one tries to ``:unmap!'' a ``:map!'' command whose
  139. right-hand-side begins with ^H (entered as ^V^H, of course), one
  140. gets the message ``That macro wasn't mapped''.  (One can get around
  141. this by using :unmap! ^V[character].)
  142.  
  143.      Certain termcaps apparently produce automatic mappings, which
  144. unfortunately may interfere with useful vi commands.  In particular,
  145. on a tvi, ^L gets mapped to a movement command, which makes it
  146. unavailable for redrawing the screen, unless unmapped.
  147.  
  148.  
  149. PROBLEMS WITH DIAGNOSTICS
  150.  
  151. "Hit return to continue" -- It took me a long time to realize that
  152. when I got this diagnostic there was an alternative to hitting
  153. return.  I suggest it be reworded
  154.     "Hit Return or :"
  155. However, the behavior of the editor when this diagnostic is given
  156. seems to be inconsistent.  In particular, when the last of a serious
  157. of commands is
  158.     :e otherfile
  159. and I get "Hit return to continue", then hitting : usually
  160. has no different effect from hitting return (or any other
  161. key), namely the screen is redrawn; yet I think that sometimes
  162. in this situation it has brought me directly to the bottom line
  163. as desired.  Very confusing.
  164.      Would it be possible to have other alternatives than : and return
  165. available, such as /pattern ?  Or, more simply, when one would presently
  166. be given the diagnostic "Hit return to continue", why not just put the
  167. editor into the state it would have if one then hit :, since one would
  168. then still have the option of hitting return and getting into vi
  169. proper, but it would not require the extra keystroke : to
  170. begin a bottom-line command, nor would one go through the frequent
  171. frustrating experience of absentmindedly starting to write a
  172. bottom-line command, or a pattern-search, and then having to wait
  173. while the screen was redrawn because one had hit a key other than :.
  174.  
  175. "Using open mode"
  176. Again, it took me a long time to learn that when I tried to enter
  177. vi and got this diagnostic, it meant that the system had somehow
  178. lost the termcap for the terminal I was on, and that I would have
  179. to do something to get the correct termcap into the environment.
  180. Till I realized this, I generally ended up either struggling along
  181. frustrated in open mode, or logging out and logging back in.  I suggest
  182. that when someone calls for vi and the termcap is not appropriate,
  183. the editor should not be invoked in any form, but instead, a message
  184. be given such as:
  185.      ``Your environment does not show a termcap entry permitting
  186. the use of the visual editor.  If you are working on a terminal not
  187. supporting vi (in particular, a device with no addressable cursor),
  188. you may enter one of the other modes of the editor with the command
  189. "open filename" or "ex filename".  If you are working on a terminal
  190. that should support vi, your environment entries are incorrect and
  191. should be corrected.  They presently show:
  192.      TERM=....
  193.      TERMCAP=....
  194. If you know the correct name or abbreviation for your terminal-
  195. type, type it at the end of the next line; if not hit return:
  196.      % setenv TERM ''
  197.      If the user typed an acceptable terminal-name, the message would
  198. continue, telling how to get the appropriate termcap.  If the user
  199. instead typed return, the message would ask him or her to type the
  200. name of the manufacturer shown on the terminal, not
  201. worrying about upper/lower-case distinctions, and a list of possible
  202. terminal names and abbreviations would be given... .  This whole
  203. program would not be part of the editor, so there would
  204. be no problem of space within the existing crowded confines of
  205. the editor code.
  206.  
  207. "No such file or directory" -- I think there should be a distinction
  208. between these two cases, because of the important distinction in the
  209. consequences when the user tries to quit the editor:
  210. If the directory exists, the file is created, but
  211. if not, the results are more complicated -- I seem to recall on one
  212. occasion simply losing what I had written on my second try
  213. at quitting; though I just now did an experiment and this time
  214. repeated ZZ's and :x's simply gave repeated error messages.
  215.  
  216. "File already exists..." -- The ``List of changes from 3.5 to 3.6'' says
  217. ``If you get I/O errors, the file is considered "not edited"... .''
  218. I presume that this correction is somehow the cause of the fact that
  219. I frequently get the above message when trying to leave the editor
  220. on a machine with version 3.7, and have to use
  221.       :w! %|q
  222. to exit.  But I've never seen any evidence that there were I/O errors;
  223. it mainly seems to happen when I've written some lines to another
  224. file in the process of editing.  So the criteria the editor is using
  225. to decide when there have been ``I/O errors'' should be rechecked.
  226.  
  227. "no such command from open/visual" -- This confused me in my first
  228. few days of using the editor, when I didn't understand that one
  229. couldn't use i and a (in either their vi or ex senses) from the bottom
  230. line of vi.  A message "i -- no such command from open/visual"
  231. was perplexing because I knew that "i" was indeed a vi command.
  232. Perhaps it should say  "no such command from open/visual bottom line".
  233.  
  234. MISCELLANEOUS PROBLEMS
  235.  
  236.      In ex search and replacement patterns, \\ is supposed to represent
  237. a real \-character, but something goes wrong when this occurs
  238. at the end of a global command.  E.g., though
  239.      :s/^/\\
  240. works OK (in vi or ex), the variant
  241.      :.g/^/s//\\
  242. definitely does not.  In vi it turns everything off, in ex it seems to
  243. behave as though there were just a single \, and in a scriptfile,
  244. it -- does something still different, which you can discover if you
  245. don't know!
  246.  
  247. The Ex Reference Manual says, ``For sanity with use from within
  248. visual mode, ex ignores a ":" preceding any command.''  But it
  249. ignores it in the wrong place! -- not at the beginning of the
  250. command line, but just before the command letter itself.  I.e.,
  251. it accepts 1,3:s/^/     /, but not :1,3s/^/    /.
  252.  
  253. SUGGESTIONS FOR MINOR ADDED CAPABILITIES
  254.  
  255.    In a multiline substitute command with the "c" option, when
  256. each line is displayed one has three choices: y, n or break.  There
  257. are some further options that would be useful.  One would be "p" --
  258. at present, "p" can only be included on the command line, which
  259. means that one has a choice between seeing the result of every
  260. substitution or none.  In practice, one would generally like to see
  261. the results of the first few cases to make sure that the command one has
  262. written does what one meant it to, and maybe a few tricky cases that
  263. come up; but not every case!   Another might be "u" -- to undo the last
  264. case for which one gave a "y".  Still another might be an option that
  265. would mean ``undo the "c" option -- I see that the substitute command
  266. is doing what I wanted, go ahead and finish it without me.''
  267.     In a command  g/pattern/p,  the pattern in question is occasionally
  268. such that it takes a while to figure out where on the line it occurs.
  269. For this purpose, an option that ``pointed out'' the instance of the
  270. pattern, in the same manner that the pattern to be replaced is pointed
  271. out in substitute command with option c, would be desirable.
  272.     When  g/pattern/p  gives more than a screenful of lines, it would
  273. be nice to have it piped through the equivalent of ``more''.
  274.  
  275.     ex has the command line option "-", which ``is useful in processing
  276. editor scripts''.  But if one wants to use a script in the course of
  277. an otherwise interactive editing session, it would be desirable to have
  278. a corresponding resettable option ``:se -'' (or ``:se nofb'').
  279.  
  280.      In strings in pattern-searches, it would be useful to have
  281. ^ and $ retain their ``magic'', so that /x[a$]/ could
  282. search for all occurrences of  x  before an  a  or a newline.
  283. (Of course, one would then have to decide whether  /x[^y]/ should
  284. include the case of  x  followed by a newline or not.)
  285.  
  286.     Just as ex allows the command :vi, so I think that vi should
  287. have some bottom-line command equivalent to the regular-mode
  288. command  Q.  When one has done some text-changing bottom-line
  289. commands, and realizes one wants to go into ex, it can be time-
  290. consuming to hit return and then Q, and wait for the screen to be
  291. redrawn for vi before one gets the ex prompt.
  292.  
  293.      The option of putting several commands on one line, separated
  294. by, "|" is particularly useful in the vi bottom-line mode, because
  295. it avoids having the screen redrawn several times.  It would be
  296. useful to be able sometimes do the same thing with non-bottom-line
  297. commands, e.g. in editing a troff file at a low baud rate on a dumb
  298. terminal one might like to be able to do  i\fI^]3Ea\fR^]  without
  299. watching the line get redrawn twice.  Perhaps some key that would
  300. cause any sequence of commands to be ``held'' until some complementary
  301. key was hit would be useful.
  302.      It would also be desirable to have a sequence of commands that had
  303. been given in this way available as one unit to be repeated by ``.'',
  304. if desired.
  305.  
  306.      The parenthesis-matching facility with % might be extended
  307. to match ` with ' and <  with  >.
  308.  
  309.      I will mention one facility that I discovered by surprize is
  310. possessed by  ed  but not  ex  --  sequences such as  \1  can be used
  311. within  ed  search-patterns.  E.g. (for the most trivial case)
  312.      /\(.\)\1/
  313. will search for doubled letters.
  314.  
  315.  
  316. DEBATABLE SUGGESTIONS
  317.      I will mention here some possible changes which have the
  318. difficulty that they would change the meaning of existing commands,
  319. so that it could be argued that the disadvantage of users having
  320. to change their habits might outweigh the advantages.
  321.  
  322.      First, one might try to resolve, one way or another, the
  323. contradiction between the count arguments taken by the join commands
  324. in  vi and  ex:  In ex, jN joins N+1 lines; in vi, NJ joins N lines
  325. (except if N=1).
  326.  
  327.      Second, the movement commands  tx  and  Tx  of vi (x any character)
  328. seem poorly defined.  Just as fx will ignore the character on which
  329. the cursor is presently sitting, even if it is an  x,  and move to the
  330. next occurrence, so I would think that  tx  should ignore the character
  331. immediately after the cursor, and  Tx  the character immediately before
  332. the cursor.  The point is that when one does  Nfx,  and finds that one
  333. had failed to count one occurrence of  x  and fallen short of where one
  334. wanted to go, one can hit  ;  and get there.  Likewise, on doing  Ntx
  335. and finding one has fallen short, one should be able to hit  ;  and get
  336. to the the next occurrence; but at present, hitting  ;  leaves
  337. the cursor in the same position; one must hit  ``2;''  to get any
  338. further.  In effect,  Ntx  is presently defined as  Nfxh;  I am
  339. suggesting that it be defined as  lNfxh.
  340.  
  341.      The sequences  cw, dw  and  yw  are presently violations of the
  342. principle that  c[movement],  d[movement]  and  y[movement]  change,
  343. delete, or yank everything from the current cursor position through
  344. the endpoint of the movement command.  cw does what one would expect of
  345. ce (in fact, they seem to be synonyms), while there is no way to get
  346. the effect which  cw  would have if it were treated ``consistently''.
  347. (E.g., if I have a line beginning  ``And if'', and I want to change it
  348. to ``If'', I cannot just put the cursor on the A and hit  cwI^].)  dw
  349. and  yw  delete up to the character immediately before the point to
  350. which ``w'' would take the cursor.  I would have to agree that this
  351. behavior of dw and  yw  is more useful than that which a literal
  352. interpretation of the movement rule would lead to; but perhaps it
  353. would become still more useful if when applied to the last word on
  354. a line, it deleted or yanked the space immediately before the word
  355. along with the word... .  On the other hand, one could argue for
  356. making a distinction between  cw  and  ce.
  357.  
  358.      Though I see the motivation for the above definitions,
  359. I see no sensible reason why  Y  should be equivalent to  yy,  when
  360. C  and  D  are equivalent to  c$  and  d$.  I would vote for changing
  361. Y  to mean  y$.
  362.  
  363. RADICAL SUGGESTIONS
  364.  
  365.      Is there any reason for maintaining the distinction between
  366. the ``:'' state of vi, and  ex  itself?  At present, there are
  367. relative advantages that lead one to choose to go into one or the
  368. other for a given operation:  From the vi-: state, it is easier
  369. to return to the regular vi state; from ex, one has a more powerful
  370. range of commands; and it is easier to give a series of commands
  371. because each carriage-return gives one a new prompt.  My suggestion
  372. is that from vi, ``:'' should carry you directly to ex, and when you
  373. are in ex, carriage-return (^M) after a command should give you a new
  374. prompt, while ^] should put you into vi.  Conceivably, things might be
  375. simplified even further, and carriage return rather than : could
  376. be the key that would carry one from the regular mode of vi into ex:
  377.  
  378.              .-------.    .-------.
  379.     .-------. a,i... | basic |  ^M    |    |
  380.     |  vi   |<------ |     |----->|  ex    |<---.
  381.     | insert|     |   vi  |    |    |    |^M
  382.     |  mode | ------>|     |<-----| mode     | ---'
  383.     `-------'  ^]     |  mode |   ^]    |    |
  384.              `-------'    `-------'
  385.  
  386. (Of course, ^M presently has a meaning in vi, but
  387. it has a synonym +.)  Clearly, there would also be no need for a
  388. special "Hit return to continue" state.
  389.      I have not distinguished vi and open in the above diagram.
  390. My idea here is that ^] would actually return you to either vi
  391. or open, whichever you had last been in, and that to switch
  392. to the other, you could enter ex and type vi^] or o^] respectively.
  393. (Or you could type  vi^M, respectively o^M, and further ex commands,
  394. and the mode would be saved for the next time you hit a ^].)  Or
  395. alternatively, these could be made settable options: se visual
  396. respectively se novisual.
  397.      Having gotten used to the editor as it now exists, I admit that
  398. I feel uneasy about the above idea -- the sense of knowing that
  399. I am ``still in vi'' when I hit :, and not that ``other land'' of ex, 
  400. represents a kind of of orientation that it is disconcerting
  401. to abandon.  But I can't see any logical disadvantage in making
  402. such a change.  Can you?  Certainly, there would be things that
  403. would have to be thought out, such as what happens to bottom-line
  404. vi pattern-searches.  My thought would be that ``/'' from vi should
  405. give :/ (i.e., put one in ex at the start of a pattern-search),
  406. and ^] after a pattern-search should put one into vi at the appropriate
  407. character on the line, in contrast to ^M after a pattern search,
  408. which would leave one in ex at the appropriate line.  In general,
  409. I think such changes would lead to greater simplicity and learnability
  410. of the editor.
  411.      I would also hope that excursions between vi and ex and back
  412. could be allowed in scriptfiles.  It might also be desirable for
  413. ex to have, in addition to a concept of ``current line'', one of
  414. ``current cursor position''... .
  415.  
  416.      Well, on to another subject.  One of the inconveniences I
  417. found very vexing when first learning to use the editor was that
  418. when in either vi insert mode, or ex/vi-bottom-line, it was very hard
  419. to edit what I was doing.  Within insert mode the only ``editing''
  420. I could do, without escaping, was with the three operations ^H,
  421. ^W and the kill character.  And on a slow line with a dumb terminal,
  422. escaping to make changes could be very time-consuming because large
  423. parts of the screen would insist on being redrawn.  Perhaps some
  424. other control-character could serve as
  425. a modified escape, that allowed one to edit what one had entered
  426. in the current insertion without having everything below it redrawn,
  427. and then return to it.  Obviously, if carried to its logical
  428. limit this idea could lead to ridiculous nests of
  429. editing operations; but there would be no need to carry it to its
  430. logical limit.
  431.      Anyway, the problem of editing ex-style commands
  432. was even worse, because there was no way to ``escape and
  433. revise''.  I eventually learned enough to realize that the solution
  434. was to edit complicated commands in another file and source it.
  435. But it is sometimes very useful to have the text on which the
  436. commands are to act in front of you when composing them (e.g., you can
  437. yank and modify various pieces), which led to the variant of writing
  438. command lines within the file I was editing, and then writing
  439. those lines into another file and sourcing that, without ever leaving
  440. the current file.  But this is distracting to deal with
  441. when concentrating on the editing task itself, which led me
  442. to divise a scriptfile which would handle the writing-to-another-file-
  443. and-sourcing for me.  Or actually, several such files:  One for
  444. single-line commands to be used essentially once; one for single-line
  445. commands that I would want to use on the same file during various
  446. editing sessions, and so would want to keep available in that
  447. file, and one for multi-line commands (to be used once).  When
  448. I first got the idea, I thought one scriptfile would be enough, and
  449. I would call it ``do'', so that the command to execute a script I
  450. had written in a file I was editing would be ``:so do''.  The
  451. file it would write to and source would be ``do.again'', so that
  452. if I wanted to reuse it, I could ``:so do.again''.  When I realized
  453. the need for several versions, ``do'' became a directory.  Here,
  454. for your amusement, are the three files.  (Re the lines ``se prompt'',
  455. cf. my comment on that under PROBLEMS WITH SOURCE etc.):
  456.  
  457.   do/1  (for 1-time use of 1-line commands)
  458.     .w! ~/do/again
  459.     d
  460.     so #
  461.     se prompt
  462.  
  463.   do/1+  (like above, without deleting the command)
  464.     .w! ~/do/again
  465.     so #
  466.     se prompt
  467.  
  468.   do/:  (to use this, write a multi-line command script, put : at
  469.   the beginning of the first line, put the cursor on the last
  470.   line of the script, and then source the following:)
  471.     ?^:?s/:/
  472.     ,''w! ~/do/again
  473.     ,''d
  474.     so #
  475.     se prompt
  476.  
  477. (I also created another version to use in case the script had
  478. to have an internal line beginning with ``:'', so that this couldn't
  479. unambiguously mark the beginning of the script.  This used
  480. a line which explicitly specified the address-range of the script.
  481. But I have never had a need for it, so I will not bother you with it.)
  482.     Finally, having gotten an account on a machine with a version 3
  483. editor recently, I have divised still another way of doing this.  I
  484. have put in my EXINIT the command
  485.  
  486.     'map ^A "ayy:@a^M'
  487.  
  488. and now, gratifyingly, the single stroke ^A has essentially the effect
  489. of ``:so do/1+''  -- except for the restrictions to which vi ``map''
  490. commands are subject.  But I've only been using this for a
  491. couple of weeks; so I have yet to learn how chafing those restrictions
  492. will or won't be.
  493.      Anyway, it might be worth thinking about whether some of these
  494. things that I've done with macros should be incorporated in some form
  495. into the editor itself; or else whether these macros might be written
  496. up in the documentation (or some tutorials) on the editor.
  497.  
  498.      Next subject: Complicated pattern-searches in long files
  499. can be time-consuming.  I have seen the point mentioned
  500. that if a pattern-description can be begun with "^",
  501. this can speed up the search -- since the pattern-comparisons need
  502. only be begun at beginnings of lines.  In some cases, this might
  503. not be possible, but the user might be aware of some other
  504. character or character-sequence in the search-pattern
  505. that will occur relatively rarely in the file.  In such cases it would
  506. be desirable if the user could specify one spot from which the pattern
  507. search should start, working forward and backward from there, to
  508. minimize false starts.  E.g., if for some reason one wants to
  509. delete every word containing the letter m, the script
  510.     %s/[^ ]*m[^ ]*//
  511. would become much less time-consuming if one could mark the point
  512. at which to begin, say writing
  513.     %s/[^ ]*\!m[^ ]*//
  514. so as to instruct the editor to search for m's, and each time
  515. one was found, to find the longest possible strings of non-space
  516. characters before and after it, and delete these.   (This is a silly
  517. example, but I think the idea is clear.)
  518.  
  519.      Something that I've seriously felt the need for is the
  520. capability of searching for lines that satisfy more than one
  521. condition.  If one just wants to locate such lines, one can
  522. of course leave the editor and do a pipeline of two or
  523. more greps; but it would be nice to be able to perform global
  524. commands on such lines.
  525.  
  526.     Finally, any possibility of introducing the capability of searching
  527. for patterns including embedded newlines, a la sed?  Multiple windows,
  528. a la emacs?
  529.  
  530. ADDENDA
  531.      I logged in this morning on an adm3a at 300 baud to go over this
  532. letter once more before sending it, and ran into another bug!  I had
  533. done 15^D to get a large scroll despite the low speed, and at one point
  534. I saw a line with a typo scrolling up.  So I noted its line-number, 402
  535. and without waiting for the screen to stop moving typed something like
  536. 402Gfsrd.  What happened was that the change was made on line 407 rather
  537. than 402 -- presumably the cursor was sent to where 402 had been when
  538. the command was received... .
  539.      Editing this letter this morning reminded me of another feature I
  540. have thought would be desirable for editing on dumb terminals at low
  541. speeds:  An option that would cause lines read from a file or typed
  542. in at the bottom of the screen to appear double spaced, with @ signs
  543. @
  544. between them, such as one gets when one deletes a line on such a
  545. @
  546. terminal.  (I have faked this effect here, though the fake will not be
  547. @
  548. very successful if you have  se nu  or  se list  on.)  The point is that
  549. @
  550. editing operations that presently cause painfully slow screen-redrawings
  551. would simply put material in in place of these fillers -- as happens
  552. now when one is lucky enough to be adding material just above a place
  553. where material was previously deleted.
  554.  
  555.         -  *  -  *  -  *  -  *  -  *  -
  556.  
  557.     I hope you've found some things of interest in this hodgepodge.
  558.  
  559.                 Yours,
  560.                 George (gbergman@brahms)
  561.  
  562. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  563. 23/7/83, about 8PM
  564.  
  565.      Maybe thinking about the editor while writing my previous
  566. ``note'' to you has made me more conscious of these things,
  567. but for some reason, I've discovered several more peculiarities of
  568. the the Version 3.7 editor today!
  569.  
  570.      First, the abbreviation feature has a strange bug (feature?)
  571. involving the backslash:  If some string X is the abbreviation
  572. for a string Y, and if X is typed (following a space etc)
  573. immediately followed by a \ and another character c, the
  574. result is not Y\c by cY\.  The case where I discovered this
  575. was a doubly complicated one: I had an abbreviation of
  576. the form
  577.     :ab x x\yZ
  578. where x and  y  were characters and Z was a string of characters.  
  579. So when I typed  x,  it presumably first expanded it as x\yZ,
  580. then performed the transformation I just described on the x\y
  581. turning it into  yx\yZ\, and thus giving the result yx\yZ\Z.
  582. This turns out to be one of the cases that can't be unmapped
  583. without doing :una ^Vx.  Further, I just tried a similar case
  584. with x replaced by a string of more than one character
  585. (namely, :ab if if\pq)  and I find I can't unmap that at all.
  586.      I also find that an abbreviated string containing | (which
  587. must be inserted using ^V|, of course) is difficult to unmap.
  588.  
  589.      Second, some peculiarities about where the cursor ends
  590. up after a yank.  If the yank involved a forward movement,
  591. the cursor stays where it is, which is the beginning
  592. of the yanked segment.  If the yank involves a backwards
  593. movement, the place where the cursor originally was is not
  594. the same as the beginning of the yanked segment, and there
  595. seems to be some confusion as to which principle is followed:
  596. y- or yk moves the cursor up, while yb leaves it fixed.
  597. Unfortunately, there is a snake in the grass with yb: If
  598. you hit p after it, the yanked word will not appear after
  599. the position where the cursor has remained, but
  600. after the position to which it would have gone if it had moved
  601. to the beginning of the yanked segment!  Likewise if you
  602. you hit an x... .
  603.      (You have no idea how much trouble I'm
  604. having with those "if"'s.  Of course, I could quit the editor
  605. and come back in, and I would lose that crazy abbreviation
  606. that way.)
  607.  
  608.      I also notice that if the cursor is at the end of a word
  609. or between words, 2e behaves the same as e!
  610.  
  611.      Finally, I note that d^, when the cursor is before the first
  612. nonwhite character, is another exception to the principle that
  613. d[motion] deletes everything through the endpoint of [motion].
  614. Similarly with c^ and y^.
  615.  
  616. - *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *- *
  617. discovered next day (not yet sent):
  618.  
  619. error with yb does not just concern p and x: any command is
  620. executed as though cursor is at destination of backward in-line
  621. yank.
  622.  
  623. N^B does not work consistently?  (Not on a medium-length file in Kim)
  624.  
  625. Can get endless-loop mapping if abbreviation forms word within
  626. abbreviated.  E.g. :ab x ( x )
  627. ``word'' must be delimited on left by space, tab,
  628. newline, start-of-insert; on right by any punctuation.  Why
  629. special ``no tail recursion'' rule?
  630.      Things like that ``if'' abbreviation can be undone using
  631. :una i^Vf!
  632.  
  633. Mention desirability of Np
  634.  
  635. copies sent to ralph@ucbarpa, lindahl@topaz 25/7/83
  636.  
  637.